Skip to content

Add dSTS integration tests#3677

Merged
bgavrilMS merged 3 commits intoAzureAD:masterfrom
XiaoxinMS2:add-dsts-integration-tests
Jan 21, 2026
Merged

Add dSTS integration tests#3677
bgavrilMS merged 3 commits intoAzureAD:masterfrom
XiaoxinMS2:add-dsts-integration-tests

Conversation

@XiaoxinMS2
Copy link
Contributor

Add dSTS integration tests

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

Summary of the changes (Less than 80 chars)
Add integration tests for dSTS token acquisition

Description

This PR adds integration tests for dSTS (Developer STS) token acquisition to verify that Microsoft.Identity.Web can successfully acquire tokens from dSTS endpoints. Currently, the only dSTS-related logic in the codebase is the SAML header logic (covered by unit tests), and these integration tests ensure end-to-end functionality with actual dSTS token acquisition.

Fixes #{bug number} (in this specific format)

- Add AcquireTokenForAppDstsIntegrationTests.cs with comprehensive dSTS token acquisition tests
- Add README_DSTS_TESTS.md with detailed setup instructions and documentation
- Update TestConstants.cs with ID4sKeyVault configuration constants
- Load dSTS configuration from Key Vault (ID4sKeyVault) and certificate from msidlabs
- Support SAML bearer tokens and certificate-based authentication (SendX5C)
- Include tests for PoP tokens, token caching, and error handling
- Use #if !FROM_GITHUB_ACTION to exclude from public CI/CD runs
- Follow security best practices: no sensitive data in test output
Replace #pragma warning disable CS8618 with cleaner = null! field initializers.
This is a more idiomatic approach that clearly indicates fields will be initialized
in the constructor while satisfying nullable reference type requirements.
…giving operator

- Remove 'null!' assignments for readonly fields in constructor
- Add explicit null checks with descriptive error messages for each configuration value
- Use 'default!' for non-readonly fields that are initialized in helper methods
- Improve error handling: separate validation exceptions from other failures
- Better fail-fast behavior with clear error messages

This addresses reviewer feedback: 'if you do a null check and throw in the ctor,
you would not need to do this?' by validating all configuration values explicitly
rather than relying on the null-forgiving operator.
@XiaoxinMS1
Copy link

@microsoft-github-policy-service agree company="Microsoft"

@XiaoxinMS2 XiaoxinMS2 marked this pull request as ready for review January 21, 2026 15:33
@XiaoxinMS2 XiaoxinMS2 requested a review from a team as a code owner January 21, 2026 15:33
@bgavrilMS bgavrilMS merged commit 669d5c7 into AzureAD:master Jan 21, 2026
7 of 8 checks passed
This was referenced Mar 1, 2026
This was referenced Mar 3, 2026
github-merge-queue bot pushed a commit to DFE-Digital/teaching-record-system that referenced this pull request Mar 9, 2026
…nIdConnect (#3193)

Updated
[Microsoft.Identity.Web](https://github.com/AzureAD/microsoft-identity-web)
from 4.0.1 to 4.5.0.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.Identity.Web's
releases](https://github.com/AzureAD/microsoft-identity-web/releases)._

## 4.4.0

### New features
- Add AOT-compatible web API authentication for .NET 10+. See
[#​3705](AzureAD/microsoft-identity-web#3705)
and
[#​3664](AzureAD/microsoft-identity-web#3664).
- Propagate long-running web API session key back to callers in user
token acquisition. See
[#​3728](AzureAD/microsoft-identity-web#3728).
- Add OBO event initialization for OBO APIs. See
[#​3724](AzureAD/microsoft-identity-web#3724).
- Add support for calling `WithClientClaims` flow for token acquisition.
See
[#​3623](AzureAD/microsoft-identity-web#3623).
- Add `OnBeforeTokenAcquisitionForOnBehalfOf` event. See
[#​3680](AzureAD/microsoft-identity-web#3680).

### Bug fixes
- Throw `InvalidOperationException` with actionable message when a
custom credential is not registered. See
[#​3626](AzureAD/microsoft-identity-web#3626).
- Fix event firing for
`InvokeOnBeforeTokenAcquisitionForOnBehalfOfAsync`. See
[#​3717](AzureAD/microsoft-identity-web#3717).
- Update `OnBeforeTokenAcquisitionForOnBehalfOf` to construct
`ClaimsPrincipal` from token. See
[#​3714](AzureAD/microsoft-identity-web#3714).
- Add a retry counter for acquire token and updated tests with a fake
secret. See
[#​3682](AzureAD/microsoft-identity-web#3682).
- Fix OBO user error handling. See
[#​3712](AzureAD/microsoft-identity-web#3712).
- Fix override merging for app token (and others). See
[#​3644](AzureAD/microsoft-identity-web#3644).
- Fix certificate reload logic to only trigger on certificate-specific
errors. See
[#​3653](AzureAD/microsoft-identity-web#3653).
- Update ROPC flow CCA to pass `SendX5C` to MSAL. See
[#​3671](AzureAD/microsoft-identity-web#3671).

### Dependencies updates
- Bump `qs` in `/tests/DevApps/SidecarAdapter/typescript`. See
[#​3725](AzureAD/microsoft-identity-web#3725).
- Downgrade Microsoft.Extensions.Configuration.Binder to 2.1.0 on .NET
Framework. See
[#​3730](AzureAD/microsoft-identity-web#3730).
- Update .NET SDK to 10.0.103 to address DOTNET-Security-10.0
vulnerability. See
[#​3726](AzureAD/microsoft-identity-web#3726).
- Upgrade to Microsoft.Identity.Abstractions 11 for AoT compatibility.
See
[#​3699](AzureAD/microsoft-identity-web#3699).
- Update to MSAL 4.81.0. See
[#​3665](AzureAD/microsoft-identity-web#3665).

### Documentation
- Add documentation for auto-generated session key for long-running OBO
session. See
[#​3729](AzureAD/microsoft-identity-web#3729).
- Improve the Aspire doc article and skills. See
[#​3695](AzureAD/microsoft-identity-web#3695).
- Add an article and agent skill to add Entra ID to an Aspire app. See
[#​3689](AzureAD/microsoft-identity-web#3689).
- Fix misleading comment in
`CertificatelessOptions.ManagedIdentityClientId`. See
[#​3667](AzureAD/microsoft-identity-web#3667).
- Add Copilot explore tool functionality. See
[#​3694](AzureAD/microsoft-identity-web#3694).

### Fundamentals
- Remove unnecessary warning suppression. See
[#​3715](AzureAD/microsoft-identity-web#3715).
- Migrate labs to Lab.API 2.x (first pass). See
[#​3710](AzureAD/microsoft-identity-web#3710).
- Update Sidecar E2E test constants. See
[#​3693](AzureAD/microsoft-identity-web#3693).
- Fix intermittent failures in `CertificatesObserverTests`. See
[#​3687](AzureAD/microsoft-identity-web#3687).
- Add validation baseline exclusions. See
[#​3684](AzureAD/microsoft-identity-web#3684).
- Add dSTS integration tests. See
[#​3677](AzureAD/microsoft-identity-web#3677).
- Fix FIC test. See
[#​3663](AzureAD/microsoft-identity-web#3663).
- Update IdentityWeb version, build logic, and validation. See
[#​3659](AzureAD/microsoft-identity-web#3659).

### New Contributors
* @​XiaoxinMS2 made their first contribution in
AzureAD/microsoft-identity-web#3677
* @​RyAuld made their first contribution in
AzureAD/microsoft-identity-web#3687
* @​agocke made their first contribution in
AzureAD/microsoft-identity-web#3664
* @​MZOLN made their first contribution in
AzureAD/microsoft-identity-web#3700
* @​christian-posta made their first contribution in
AzureAD/microsoft-identity-web#3644
* @​4gust made their first contribution in
AzureAD/microsoft-identity-web#3682
* @​rayluo made their first contribution in
AzureAD/microsoft-identity-web#3714

## 4.4.0-preview.1

### New features
- Add AOT-compatible web API authentication for .NET 10+. See
[#​3705](AzureAD/microsoft-identity-web#3705)
and
[#​3664](AzureAD/microsoft-identity-web#3664).
- Propagate long-running web API session key back to callers in user
token acquisition. See
[#​3728](AzureAD/microsoft-identity-web#3728).
- Add OBO event initialization for OBO APIs. See
[#​3724](AzureAD/microsoft-identity-web#3724).
- Add support for calling `WithClientClaims` flow for token acquisition.
See
[#​3623](AzureAD/microsoft-identity-web#3623).
- Add `OnBeforeTokenAcquisitionForOnBehalfOf` event. See
[#​3680](AzureAD/microsoft-identity-web#3680).

### Bug fixes
- Throw `InvalidOperationException` with actionable message when a
custom credential is not registered. See
[#​3626](AzureAD/microsoft-identity-web#3626).
- Fix event firing for
`InvokeOnBeforeTokenAcquisitionForOnBehalfOfAsync`. See
[#​3717](AzureAD/microsoft-identity-web#3717).
- Update `OnBeforeTokenAcquisitionForOnBehalfOf` to construct
`ClaimsPrincipal` from token. See
[#​3714](AzureAD/microsoft-identity-web#3714).
- Add a retry counter for acquire token and updated tests with a fake
secret. See
[#​3682](AzureAD/microsoft-identity-web#3682).
- Fix OBO user error handling. See
[#​3712](AzureAD/microsoft-identity-web#3712).
- Fix override merging for app token (and others). See
[#​3644](AzureAD/microsoft-identity-web#3644).
- Fix certificate reload logic to only trigger on certificate-specific
errors. See
[#​3653](AzureAD/microsoft-identity-web#3653).
- Update ROPC flow CCA to pass `SendX5C` to MSAL. See
[#​3671](AzureAD/microsoft-identity-web#3671).

### Dependencies updates
- Bump `qs` in `/tests/DevApps/SidecarAdapter/typescript`. See
[#​3725](AzureAD/microsoft-identity-web#3725).
- Downgrade Microsoft.Extensions.Configuration.Binder to 2.1.0 on .NET
Framework. See
[#​3730](AzureAD/microsoft-identity-web#3730).
- Update .NET SDK to 10.0.103 to address DOTNET-Security-10.0
vulnerability. See
[#​3726](AzureAD/microsoft-identity-web#3726).
- Upgrade to Microsoft.Identity.Abstractions 11 for AoT compatibility.
See
[#​3699](AzureAD/microsoft-identity-web#3699).
- Update to MSAL 4.81.0. See
[#​3665](AzureAD/microsoft-identity-web#3665).

### Documentation
- Add documentation for auto-generated session key for long-running OBO
session. See
[#​3729](AzureAD/microsoft-identity-web#3729).
- Improve the Aspire doc article and skills. See
[#​3695](AzureAD/microsoft-identity-web#3695).
- Add an article and agent skill to add Entra ID to an Aspire app. See
[#​3689](AzureAD/microsoft-identity-web#3689).
- Fix misleading comment in
`CertificatelessOptions.ManagedIdentityClientId`. See
[#​3667](AzureAD/microsoft-identity-web#3667).
- Add Copilot explore tool functionality. See
[#​3694](AzureAD/microsoft-identity-web#3694).

### Fundamentals
- Remove unnecessary warning suppression. See
[#​3715](AzureAD/microsoft-identity-web#3715).
- Migrate labs to Lab.API 2.x (first pass). See
[#​3710](AzureAD/microsoft-identity-web#3710).
- Update Sidecar E2E test constants. See
[#​3693](AzureAD/microsoft-identity-web#3693).
- Fix intermittent failures in `CertificatesObserverTests`. See
[#​3687](AzureAD/microsoft-identity-web#3687).
- Add validation baseline exclusions. See
[#​3684](AzureAD/microsoft-identity-web#3684).
- Add dSTS integration tests. See
[#​3677](AzureAD/microsoft-identity-web#3677).
- Fix FIC test. See
[#​3663](AzureAD/microsoft-identity-web#3663).
- Update IdentityWeb version, build logic, and validation. See
[#​3659](AzureAD/microsoft-identity-web#3659).

## 4.3.0

### New features
- Added token binding (mTLS PoP) scenario for confidential client
(app-only) token acquisition and downstream API calls. See
[#​3622](AzureAD/microsoft-identity-web#3622).

### Dependencies updates
- Bumped **qs** from 6.14.0 to 6.14.1 in
/tests/DevApps/SidecarAdapter/typescript. See [#​3660](
AzureAD/microsoft-identity-web#3660).

### Documentation
- Modernized Identity Web documentation, which is now can be found in
[docs](https://github.com/AzureAD/microsoft-identity-web/tree/master/docs).
See
[#​3566](AzureAD/microsoft-identity-web#3566).
- Added token binding (mTLS PoP) documentation. See
[#​3661](AzureAD/microsoft-identity-web#3661).

## 4.2.0

# What's Changed

## New features

- Added CAE claims support for FIC + Managed Identity. See #​3647 for
details.
- Added AddMicrosoftIdentityMessageHandler extension methods for
IHttpClientBuilder. See #​3649 for details.

## Bug fixes


- Fixed tenant not being propagated in credential FIC acquisition. See
#​3633 for details.
- Fixed ForAgentIdentity hardcoded 'AzureAd' ConfigurationSection to
respect AuthenticationOptionsName. See #​3635 for details.
- Fixed GetTokenAcquirer to propagate MicrosoftEntraApplicationOptions
properties. See #​3651 for details.
- Added meaningful error message when identity configuration is missing.
See #​3637 for details.

## Dependencies updates

- Update Microsoft.Identity.Abstractions to version 10.0.0.
- Bump express from 5.1.0 to 5.2.0 in
/tests/DevApps/SidecarAdapter/typescript. #​3636
- Bump jws from 3.2.2 to 3.2.3 in
/tests/DevApps/SidecarAdapter/typescript. #​3641

## Fundamentals

- Update support policy. #​3656
- Update agent identity coordinates in E2E tests after deauth. #​3640
- Update E2E agent identity configuration to new tenant. #​3646


**Full Changelog**:
AzureAD/microsoft-identity-web@4.1.1...4.2.0

## 4.1.1

### Bug fixes
- Authority-only configuration parsing improvements: Early parsing of
Authority into Instance/TenantId and defensive fallback in
PrepareAuthorityInstanceForMsal. Behavior is backward compatible;
Authority is still ignored when Instance/TenantId explicitly
provided—now surfaced via a warning. See
[#​3612](AzureAD/microsoft-identity-web#3612).

### New features
- Added warning diagnostics for conflicting Authority vs
Instance/TenantId: Emitting a single structured warning when both styles
are provided. See
[#​3611](AzureAD/microsoft-identity-web#3611).

### Fundamentals
- Expanded authority test matrix: Coverage for AAD (v1/v2), B2C (/tfp/
normalization, policy path), CIAM (PreserveAuthority), query parameters,
scheme-less forms, and conflict scenarios. See
[#​3610](AzureAD/microsoft-identity-web#3610).

## 4.1.0

### New features
- Migrate to .NET 10 GA.
[#​3449](AzureAD/microsoft-identity-web#3449)
and
[#​3590](AzureAD/microsoft-identity-web#3590)

### Dependencies updates
- Bump MSAL.NET to version
[4.79.2](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/releases/tag/4.79.2)
and handle changes to deprecated WithExtraQueryParameters APIs.
[#​3583](AzureAD/microsoft-identity-web#3583)
- Update Microsoft.IdentityModel and Abstractions versions.
[#​3604](AzureAD/microsoft-identity-web#3604)
- Update coverlet.collector to 6.0.4.
[#​3587](AzureAD/microsoft-identity-web#3587)
- Update package validation baseline version to 4.0.0.
[#​3589](AzureAD/microsoft-identity-web#3589)
- Bump js-yaml from 4.1.0 to 4.1.1 in
/tests/DevApps/SidecarAdapter/typescript.
[#​3595](AzureAD/microsoft-identity-web#3595)

### Entra ID SDK sidecar
- Restrict hosts to localhost for sidecar.
[#​3579](AzureAD/microsoft-identity-web#3579)
- Update http file to match endpoints.
[#​3555](AzureAD/microsoft-identity-web#3555)
- Revise sidecar issue template for Entra ID.
[#​3577](AzureAD/microsoft-identity-web#3577)

### Documentation
- Update README to include Entra SDK container info.
[#​3578](AzureAD/microsoft-identity-web#3578)

### Fundamentals
- Include NET 9.0 in template-install-dependencies.
[#​3593](AzureAD/microsoft-identity-web#3593)
- Fix CodeQL alerts.
[#​3591](AzureAD/microsoft-identity-web#3591)
- Suppression file is needed.
[#​3592](AzureAD/microsoft-identity-web#3592)

Commits viewable in [compare
view](https://github.com/AzureAD/microsoft-identity-web/commits).
</details>

Updated
[Microsoft.IdentityModel.Protocols.OpenIdConnect](https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet)
from 8.14.0 to 8.15.0.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.IdentityModel.Protocols.OpenIdConnect's
releases](https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/releases)._

## 8.15.0

## New Features
- **Add ECDsa support in `X509SecurityKey` and
`JsonWebKeyConverter.ConvertFromX509SecurityKey`**
Extended `X509SecurityKey` and
`JsonWebKeyConverter.ConvertFromX509SecurityKey` to support ECDSA keys.
See PR
[#​2377](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#2377)
for details.

## Bug Fixes
- **Sanitize logs to avoid leaking sensitive data**  
Updated logging to sanitize sensitive values, reducing the risk of
inadvertently exposing secrets or PII in logs.
See PR
[#​3316](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3316)
for details.
- **Optimize log sanitization with `SearchValues`**  
Improved the performance of the log sanitization logic introduced
earlier by using `SearchValues`, making sanitization more efficient in
high-throughput scenarios.
See PR
[#​3341](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3341)
for details.
- **Update test for `IDX10400`**  
Adjusted the `IDX10400` test to align with the current behavior and
error messaging.
See PR
[#​3314](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3314)
for details.

## Fundamentals
- **Add supported algorithm tests**  
Added new tests to validate the set of supported cryptographic
algorithms, increasing confidence in algorithm coverage and
compatibility.
See PR
[#​3296](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3296)
for details.
- **Migrate repository agent rules from `.clinerules` to `agents.md`**  
Moved repository agent/AI-assist rules into markdown documentation to
make them more visible and easier to maintain.
See PR
[#​3313](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3313)
for details.
- **Migrate `Microsoft.IdentityModel.TestExtensions` from
Newtonsoft.Json to System.Text.Json**
Updated `Microsoft.IdentityModel.TestExtensions` to use
`System.Text.Json` instead of `Newtonsoft.Json`, aligning tests with the
runtime serialization stack.
See PR
[#​3356](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3356)
for details.
- **Disable code coverage comments**  
Turned off automated code coverage comments on PRs to reduce noise while
retaining coverage data elsewhere.
See PR
[#​3349](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3349)
for details.
- **Fix CodeQL alerts**  
Addressed CodeQL-reported issues to improve security posture and static
analysis cleanliness.
See PR
[#​3364](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3364)
for details.

### .NET 10 / SDK and tooling updates
- **Building with .NET 10 preview / RC 1**  
Updated the repository to build and test against .NET 10.0 preview/RC1,
ensuring early compatibility with the upcoming runtime.
See PRs
[#​3287](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3287),
[#​3357](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3357),
and
[#​3358](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3358)
for details.
- **Fix .NET 10 test execution consistency**  
Ensured consistent use of the `TargetNetNext` parameter across build,
test, and pack phases so .NET 10.0 tests execute reliably.
See PR
[#​3337](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3337)
for details.
- **Update project files and workflows for .NET 10.0 compatibility**  
Adjusted project files and CI workflows to correctly target and run on
.NET 10.0, including test and pack scenarios.
See PR
[#​3363](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3363)
for details.
- **Update .NET version to meet CG compliance**  
Updated the .NET version references to be compliant with corporate
governance (CG) requirements.
See PR
[#​3353](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3353)
for details.
- **Update Coverlet collector and test SDK**  
  - Bumped `CoverletCollectorVersion` to 6.0.4.  
See PR
[#​3333](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3333)
for details.
- Upgraded `Microsoft.NET.Test.Sdk` to a newer version for improved test
reliability and tooling support.
 ... (truncated)

Commits viewable in [compare
view](AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet@8.14.0...8.15.0).
</details>

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: James Gunn <james@gunn.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants